﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;

namespace StorageManage.Logic
{
    /// <summary>
    /// HandlerLogin 的摘要说明
    /// </summary>
    public class HandlerLogin : IHttpHandler,IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string username=context.Request.Form["username"];
            string password = context.Request.Form["password"];
            BD_UserInfo userinfo = DALSession.Current.BD_UserInfoDAL.GetListBy(o => o.UserName == username && o.PassWord == password).FirstOrDefault();
            if (userinfo!=null)
            {
                context.Session["userinfo"] = userinfo;
                context.Response.Write("ok");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}